<h2>文章分类管理</h2>
<?php 
$this->menu = array(
	array('label'=>'添加分类', 'url'=>array('edit'), 'visible'=>Yii::app()->user->v('manage@ArticleCateEdit')),
);

function render_node($nodes){
	if(empty($nodes)){
		return;
	}
	foreach ($nodes as $nid=>$node){
		echo '<tr class="row" parent="' . $node['parent'] . '">';
		echo CHtml::tag('td', array(), $node['name']);
		echo CHtml::tag('td', array('class'=>'right'), $node['rank']);
		$link = array();
		$link[] = YHtml::link('预览', '/Manage/ArticleCate/View/' . $nid, array('visible'=>Yii::app()->user->v('manage@ArticleView')));
		$link[] = YHtml::link('文章列表', '/Manage/Article/Admin/' . $nid, array('visible'=>Yii::app()->user->v('manage@ArticleAdmin')));
		$link[] = YHtml::link('添加文章', '/Manage/Article/Edit/cate/' . $nid, array('visible'=>Yii::app()->user->v('manage@ArticleEdit')));
		if(Yii::app()->user->v("manage@ArticleCateEdit")){
			$link[] = YHtml::link('修改', '/Manage/ArticleCate/Edit/' . $nid);
			$link[] = YHtml::link('添加子分类', '/Manage/ArticleCate/Edit/parent/' . $nid);
		}
		$link[] = YHtml::link('删除', 'javascript:void(0)', array('visible'=>Yii::app()->user->v('manage@ArticleCateDelete'), 'onclick'=>'delete_cate()'));
		
		$link = array_filter($link);
		echo CHtml::tag('td', array(), implode(' | ', $link));
		echo '</tr>';
		if(isset($node['children'])){
			render_node($node['children']);
		}
	}
}
?>
<table class="y_table">
	<tr>
		<th>文章分类</th><th>排序</th><th>操作</th>
	</tr>
	<?php render_node($tree);?>
</table>